package com.cea.papyrus.diagram.classdiagram.commands;

import java.util.List;

import com.cea.papyrus.core.commands.PapyrusCommand;

public class SynchronizationWithBoundElementsCommand extends PapyrusCommand {
	
	private List<com.cea.papyrus.umlutils.TemplateableElement.SynchronizationAction> actionsToBePerformed ;
	
	public SynchronizationWithBoundElementsCommand(List<com.cea.papyrus.umlutils.TemplateableElement.SynchronizationAction> actionsToBePerformed) {
		this.actionsToBePerformed = actionsToBePerformed ;
	}
	
	@Override
	public void execute() {
		for (int i = 0 ; i<actionsToBePerformed.size() ; i++) {
			actionsToBePerformed.get(i).execute() ;
		}
	}

	@Override
	public String getLabel() {
		// TODO Auto-generated method stub
		return super.getLabel();
	}

	@Override
	public void redo() {
		for (int i = 0 ; i<actionsToBePerformed.size() ; i++) {
			actionsToBePerformed.get(i).redo() ;
		}
	}

	@Override
	public void undo() {
		for (int i = actionsToBePerformed.size()-1 ; i>=0 ; i--) {
			actionsToBePerformed.get(i).undo() ;
		}
	}

	
}
